#ifndef HJ212_MESSAGE_H__
#define HJ212_MESSAGE_H__

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>


#ifdef __cplusplus
extern "C" {
#endif

typedef struct _tag_hj212_message_t
{
    char* qn;
    unsigned char st;
    unsigned short cn;
    char* pwd;
    char* mn;
    unsigned char flag;
    int length;
    unsigned char payload[];
} HJ212Msg;

HJ212Msg* HJ212_create_message(const char* qn, const unsigned char st, const unsigned short cn, const char* pwd, const char* mn, char flag, const char* payload, int length);

void HJ212_destroy_message(HJ212Msg* msg);

int Hj212_size(HJ212Msg* msg);

char* Hj212_qn_new(void);

#ifdef __cplusplus
}
#endif

#endif  // HJ212_MESSAGE_H__